PROJECT=libaklys
V_MAJOR=1
V_MINOR=0
V_BUILD=0

TYPE=dll
BUILDMODE=debug

CC=mcs
CFLAGS=
DEFINES=-d:MONO -d:Framework_4_0
LIBS=-r:System -r:System.Web.Extensions

#================================
FINALNAME=$(PROJECT).$(TYPE)

ifeq ($(BUILDMODE),debug)
	CFLAGS+= -debug+
else
	CFLAGS+= -optimize+
endif

ifeq ($(TYPE),dll)
	CFLAGS += -target:library
else
	CFLAGS += -target:exe
endif

# recursive wildcard function
rwildcard=$(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) $(filter $(subst *,%,$2),$d))

SOURCES=$(call rwildcard,,*.cs)

all: $(FINALNAME)
	-chmod a+x $(FINALNAME)
	-@cp $(FINALNAME) ..

$(FINALNAME): $(SOURCES)
	$(CC) $(CFLAGS) $(DEFINES) $(LIBS) -out:$(FINALNAME) $(SOURCES)

clean:
	-rm $(FINALNAME)
	-rm $(FINALNAME).mdb

spotless: clean
	-find . -name '*~' -exec rm {} \;
